# 闭包
def func():
    c = 0

    def count(l):
        nonlocal c
        for i in l:
            c += i
        print(c)

    return count


# 类,  主类
class F():
    c = 0

    def count(self, l):
        for i in l:
            self.c += i

    def get_c(self):
        print(self.c)


# 混入类
class MixinSub():
    def sub(self, l):
        for i in l:
            self.c -= i


class M(MixinSub, F):
    pass

m = M()

m.count([1,2,3])
m.get_c()
m.sub([1,1,1])
m.get_c()